package com.qidian.qc.controller;

import com.qidian.mes.pojo.qc.QcDefect;
import com.qidian.mes.util.pojo.MESResult;
import com.qidian.qc.service.QcDefectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 53邹李萍
 * @Company 起点编程
 * @Time 2023/10/26 15:10
 * @Description
 */
@RequestMapping("/defect")
@CrossOrigin
@RestController
public class QcDefectController {
    @Autowired
    QcDefectService qcDefectService;
    @GetMapping("/get")
    public MESResult get( String defectCode){
        return qcDefectService.getByDefectCode(defectCode);
    }
    @GetMapping("/list")
    public MESResult list(@RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10") int limit, QcDefect qcDefect){
        return qcDefectService.list(page,limit,qcDefect);
    }
    @PostMapping("/save")
    public MESResult save(@RequestBody QcDefect defect){
        return qcDefectService.save(defect);
    }

    @PostMapping ("/update")
    public MESResult update(@RequestBody QcDefect defect){
        return qcDefectService.update(defect);
    }

    @DeleteMapping("/delete")
    public MESResult delete(String defectCode){
        return qcDefectService.deleteByDefectCode(defectCode);
    }
    @DeleteMapping("/deletes")
    public MESResult deletes(String[] defectCode){

        return qcDefectService.deleteByDefectCodes(defectCode);
    }















}
